<?php
/**
* @package RAM_ListSectors
* @version 1.5.0 Stable, July 2009
*/

class mod_RAM_ListSectorsHelper {
//
// get list of sectors from  Recruitment Agency Manager
//
function getSectorList()    {
	global $msg;

	$sectors = array();

	//get the database configuration settings
	$conf =& JFactory::getConfig();
	$dbhost = $conf->getValue('config.host');
	$dbuser = $conf->getValue('config.user');
	$dbpassword = $conf->getValue('config.password');
	$dbname = $conf->getValue('config.db');
	$dbprefix = $conf->getValue('config.dbprefix');

	// connect to the database
	mysql_connect($dbhost,$dbuser,$dbpassword) or die("mysql_connect fail");
	mysql_select_db($dbname) or die("mysql_select_db fail");

	$query="SELECT * FROM ".$dbprefix."RAM_Sectors ORDER BY `desc` ASC ";
//	$msg = "SQL: $query<br />\n";
	$sth=mysql_query($query);
	$num_rows = mysql_num_rows($sth);
	// records found?	
	if ($num_rows>0) {
		// yes
		while ($row=mysql_fetch_array($sth, MYSQL_ASSOC)) {
			$sectors[] = $row; // add the sector details to the array
		}

	} else { // no, return error message

		$msg = JText::_('RAM_LJM_NOSECTORS');

	} // eof check for records found

        return $sectors; // return any sectors found

} // end function getSectorList


} // eof class

?>
